package com.rednose.videoplayer.controller;

import com.rednose.videoplayer.Dao.UserDao;
import com.rednose.videoplayer.model.User;

import android.content.Context;

public class LoginController {
    private UserDao userDao;

    public LoginController(Context context) {
        userDao = new UserDao(context);
    }

    public boolean login(String username, String passwordHash) {
        User user = userDao.getUserByUsername(username);
        if (user != null && user.getPasswordHash().equals(passwordHash)) {
            return true;
        }
        return false;
    }
    public User getUser(String username) {
        return userDao.getUserByUsername(username);
    }
}
